#include <stdio.h>
#include <algorithm>
using namespace std;

#define rep(i,n) for (int i=0; i<n; i++)

#define TRACE(x...)  
#define PRINT(x...) TRACE(printf(x))

int nsq[1000010];
int msq[1000010];
int n, m, s;
int nmax, mmax;
int nc, mc;
long long ans;

int main() {
	scanf("%d %d %d", &n, &m, &s);

	rep(i, n) nsq[i] = (i/s+(n-i-1)/s);
	rep(i,m) msq[i] = (i/s+(m-i-1)/s);

	TRACE(
		printf("Nsq:\n");
		rep(i,n) printf("%d ", nsq[i]);
		printf("\n");
		
		printf("Msq:\n");
		rep(i,m) printf("%d ", msq[i]);
		printf("\n");
	)

	nmax=-1; mmax=-1;

	rep(i,n) nmax = nmax<nsq[i]? nsq[i] : nmax;
	rep(i,m) mmax = mmax<msq[i]? msq[i] : mmax;

	nc=0; mc=0;

	rep(i,n) nmax==nsq[i]? nc++ : 1;
	rep(i,m) mmax==msq[i]? mc++ : 1;

	PRINT("%d %d\n", nmax, mmax);
	ans = (long long) mc;
	ans*= (long long) nc;

	printf("%I64d\n", ans);

	return 0;
}
